package com.gamebox.view;

import java.awt.Container;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JDialog;
import javax.swing.JLabel;

import com.gamebox.javaBean.User;

public class InfoDialog extends JDialog{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2845706587252420927L;
	private User user;
	public InfoDialog(User user){
		this.user = user;
		this.setTitle("查询个人信息");
		this.setBounds(300, 300, 400, 400);
		Container con=this.getContentPane(); 
		con.setLayout(null);
		JLabel nameLable = new JLabel("用户名:");
		JLabel name = new JLabel(user.getName());
		nameLable.setBounds(20, 20, 100, 30);
		name.setBounds(130, 20, 100, 30);
		JLabel nickLable = new JLabel("昵称:");
		JLabel nick = new JLabel(user.getNickName());
		nickLable.setBounds(20, 60, 100, 30);
		nick.setBounds(130, 60, 100, 30);
		JLabel regLable = new JLabel("注册时间:");
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		JLabel regTime = new JLabel(sdf.format(user.getRegisterTime()));
		regLable.setBounds(20, 100, 100, 30);
		regTime.setBounds(130, 100, 100, 30);
		con.add(nameLable);
		con.add(name);
		con.add(nickLable);
		con.add(nick);
		con.add(regLable);
		con.add(regTime);
		this.setVisible(true);
		this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
	}
}
